import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("ak_user_assets_user_id_asset_address", ["userId", "assetAddress"], {})
@Entity("tb_user_assets", { schema: "db_test" })
export class TbUserAssets {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("int", {
    name: "user_id",
    comment: "用户ID",
    unsigned: true,
    default: () => "'0'",
  })
  userId: number;

  @Column("varchar", {
    name: "asset_address",
    comment: "用户地址",
    length: 50,
    default: () => "''",
  })
  assetAddress: string;

  @Column("smallint", {
    name: "asset_type",
    comment: "资产类型",
    unsigned: true,
    default: () => "'0'",
  })
  assetType: number;

  @Column("int", {
    name: "token_id",
    comment: "资产tokenId",
    unsigned: true,
    default: () => "'0'",
  })
  tokenId: number;

  @Column("int", {
    name: "amount",
    comment: "资产数量",
    unsigned: true,
    default: () => "'0'",
  })
  amount: number;

  @Column("timestamp", {
    name: "created_at",
    comment: "创建时间",
    default: () => "'0000-00-00 00:00:00'",
  })
  createdAt: Date;

  @Column("timestamp", {
    name: "updated_at",
    comment: "更新时间",
    default: () => "'0000-00-00 00:00:00'",
  })
  updatedAt: Date;

  @Column("tinyint", {
    name: "is_deleted",
    comment: "是否删除(1-是)",
    unsigned: true,
    default: () => "'0'",
  })
  isDeleted: number;
}
